package com.zxy.broker.service.impl;


import com.zxy.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zxy.common.utils.PageUtils;
import com.zxy.common.utils.Query;

import com.zxy.broker.dao.BrokerDao;
import com.zxy.broker.entity.BrokerEntity;
import com.zxy.broker.service.BrokerService;


@Service("brokerService")
public class BrokerServiceImpl extends ServiceImpl<BrokerDao, BrokerEntity> implements BrokerService {



    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<BrokerEntity> wrapper = new QueryWrapper<>();
        String province = (String) params.get("province");
        if (province!=null&&province!=""){
            int s = Integer.parseInt(province);
            wrapper.eq("province",s);
        }
        String city = (String) params.get("city");
        if (city!=null&&city!=""){
            int s = Integer.parseInt(city);
            wrapper.eq("city",s);
        }
        String region = (String) params.get("region");
        if (region!=null&&region!=""){
            int s = Integer.parseInt(region);
            wrapper.eq("region",s);
        }
        IPage<BrokerEntity> page = this.page(
                new Query<BrokerEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}